package com.file;

import java.io.File;
import java.io.FileWriter;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;

public class FileDemo02 {

    public static void main(String[] args) throws Exception{

        RuntimeMXBean mxb2 = ManagementFactory.getRuntimeMXBean();
        System.out.println("FileDemo01 ===> " + mxb2.getName()); //2668@Sindrol-PC

        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0;i < 500000000; i++){
            stringBuilder.append("极");
        }

        File file =  new File( "/Users/tanweihua/Desktop/multiwrite/qqq.txt");
        FileWriter writer = new FileWriter(file);
        writer.write(stringBuilder.toString());
        writer.flush();
        writer.close();
    }

    public static char getRandomChar() {
        return (char) (0x4e00 + (int) (Math.random() * (0x9fa5 - 0x4e00 + 1)));
    }
}

class MyT extends Thread{

    @Override
    public void run() {
        RuntimeMXBean mxb2 = ManagementFactory.getRuntimeMXBean();
        System.out.println("多线程" + mxb2.getName()); //2668@Sindrol-PC
    }
}